package com.igbeok.miscellaneous.concurrency;

public class Exercise1 implements Runnable {

	public static int COUNT = 0;
	private int id = COUNT++;

	public Exercise1() {
		System.out.println("#" + id + " initialized!");
	}

	public void run() {
		System.out.println("#" + id + " message1!");
		Thread.yield();
		System.out.println("#" + id + " message2!");
		Thread.yield();
		System.out.println("#" + id + " message3!");
		Thread.yield();
	}

	@Override
	protected void finalize() throws Throwable {
		super.finalize();
		System.out.println("destroy");
	}

}
